<template>
  <div>
    <button @click="add">+1</button>
    <button @click="addN">+N</button>
    <button @click="addasync">+1 async</button>
    {{ this.$store.getters.show }}
  </div>
</template>

<script>
export default {
  methods: {
    add() {
      this.$store.commit('addcount')
    },
    addN() {
      //可传入参数
      this.$store.commit('addn', 5)
    },
    addasync() {
      //dispatch专门用来触发
      this.$store.dispatch('asyncadd')
    }
  }
}
</script>

<style></style>
